package com.artifact.yungou;

import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.artifact.model.GoodsInfo;
import com.artifact.services.YungouPublishAjaxServices;

/*
 * 云购监控服务
 */
public class YungouMonitoringServer {
	public static void selectGoodsInfo() {// 查询商品信息
		@SuppressWarnings("resource")
		ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
		YungouPublishAjaxServices yungouPublishAjaxServices = ctx.getBean("yungouPublishAjaxServices",
				YungouPublishAjaxServices.class);
		List<GoodsInfo> goodsInfoList = yungouPublishAjaxServices.getGoodsInfosBySale();
		if (goodsInfoList != null) {
			for (GoodsInfo goodsInfo : goodsInfoList) {
				CacheData.setGoodsInfoDate(Integer.toString(goodsInfo.getGoodsID()), goodsInfo);
			}
		}
		System.out.println("商品数据大小：" + CacheData.getGoodsInfoDate().size());
	}
}
